<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateYsChapterTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('chapter', function(Blueprint $table)
		{
			$table->increments('id')->comment('主键id');
			$table->string('chapter_num', 32)->index('chapter_chapter_num_index')->comment('章节编号');
			$table->string('book_num', 32)->index('chapter_book_num_index')->comment('关联书籍编号');
			$table->string('name', 64)->comment('章节名称(卷)');
			$table->tinyInteger('type')->default(0)->comment('属性0为章,1为卷');
			$table->string('pid', 32)->nullable()->comment('卷id没有卷是为null');
			$table->integer('create_time')->nullable()->comment('创建时间');
			$table->tinyInteger('status')->nullable()->default(1)->comment('是否已发布,1为发布2为已删除');
			$table->bigInteger('indexes')->comment('索引判断章节顺序');
			$table->integer('last_modify_time')->nullable()->comment('最后跟新时间');
			$table->integer('delete_time')->nullable()->comment('删除时间');
			$table->tinyInteger('examine')->nullable()->default(0)->comment('审核状态1为通过2为需要审核');
			$table->timestamp('synced_at')->nullable()->comment('章节第一次同步的时间');
			$table->timestamps();
		});
	}


	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('chapter');
	}

}
